<?php

namespace App\Jobs;

use Illuminate\Bus\Queueable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;

class SendTemplate implements ShouldQueue
{
    use InteractsWithQueue, Queueable, SerializesModels;

    protected $data;
    /**
     * @var
     */
    private $url;
    /**
     * @var
     */
    private $openIds;
    /**
     * @var
     */
    private $template;

    /**
     * Create a new job instance.
     *
     * @param $data
     * @param $url
     * @param $openIds
     * @param $template
     */
    public function __construct($data, $url, $openIds, $template)
    {
        $this->data = $data;
        $this->url = $url;
        $this->openIds = $openIds;
        $this->template = $template;
    }

    /**
     * Execute the job.
     *
     * @return void
     */
    public function handle()
    {
        \WechatService::sendNotice($this->data, $this->url, $this->openIds, $this->template);
    }
}
